/*
 * Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
 *
 * Licensed under the Mulan PSL v2.
 * You can use this file according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of the License at
 *
 *     http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
 * FOR MORE DETAILS.
 */

/**
 * @brief   : 提供的数据存储接口
 * @version : 0.1
 * @author  : 武兴创
 * @date    : 2024.10.21
 */
#pragma once

#include "DataStructure/Input/Constraint/ConstraintType.h"

#include "DBManager/Common/Trait/InputTrait.h"
#include "DBManager/DBServiceFactory.h"

SG_DBMANAGER_NAMESPACE_OPEN

class DBManager_DECLSPEC IRElementSummaryService
{
  public:
    virtual ~IRElementSummaryService () {};

    /** @brief 模型中包含的单元类型
     *
     * 此处不包含所有的R单元
     */
    virtual std::vector<SG::DataStructure::FEM::RElementType> GetAllRElementTypes () const = 0;

    /**
     * @brief   : Get the Element Type By Id
     * @param   : eid
     * @return  :
     * @author  : wxc
     * @date    : 2024.10.21
     */
    virtual SG::DataStructure::FEM::RElementType GetRElementType (SG::DataStructure::Common::Id eid) const = 0;

    /**
     * @brief   :  类型为`type`的单元的数量
     * @param   : type
     * @return  :
     * @author  : wxc
     * @date    : 2024.10.21
     */
    virtual std::size_t GetRElementSize (SG::DataStructure::FEM::RElementType type) const = 0;

    /**
     * @brief  根据单元ID获取单元类型和Index
     *
     * @param    eleId
     * @param    etypes 未使用
     * @return   单元类型和Index
     * @author   wuxingchuang
     * @date     2025.02.06
     */
    virtual std::pair<SG::DataStructure::FEM::RElementType, std::size_t>
    FindRElement (SG::DataStructure::Common::Id eleId, const std::vector<SG::DataStructure::FEM::RElementType>& etypes = {}) const = 0;

    /**
     * @brief    获取所有单元Id
     *
     * @return
     * @author   wuxingchuang
     * @date     2025.02.19
     */
    virtual std::vector<SG::DataStructure::Common::Id> GetAllRElementId () const = 0;

    /**
     * @brief    将对应ID的数据库复制至dest数据库
     *
     * @param    src
     * @param    dest
     * @param    id
     * @author   wuxingchuang
     * @date     2025.02.20
     */
    virtual SG::DataStructure::Common::Status CopyData (DBServiceFactory* const                    dest,
                                                        std::vector<SG::DataStructure::Common::Id> id) const = 0;
};

template <>
std::shared_ptr<IRElementSummaryService> DBManager_DECLSPEC DBServiceFactory::get ();

SG_DBMANAGER_NAMESPACE_CLOSE
